package com.lrs.java.j2se_base.exception;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class TestException {
	/*
	public void m(int i) throws ArithmeticException{
		if(i == 0)
			throw new ArithmeticException("hello");
	}
	*/
	
	public void f() throws FileNotFoundException , IOException {
		FileInputStream in = null ;
		in = new FileInputStream("myfile.txt");
	        int b;
	        b = in.read();
	        while (b != -1) {
	            System.out.print((char) b);
	            b = in.read();
	        }
	}
	
	public void f2() throws IOException {
		f();
	}

	public static void main(String[] args){
		TestException ex = new TestException();
		try{
			ex.f2();
		}catch(FileNotFoundException e){
			System.out.println(e.getMessage());
		}catch(IOException e2){
			e2.printStackTrace();
		}
		/*try{
			ex.m(0);
		}catch(ArithmeticException e){
			e.printStackTrace();
		}*/
		/*
		FileInputStream in = null;
		
	    try {
	        in = new FileInputStream("myfile.txt");
	        int b;
	        b = in.read();
	        while (b != -1) {
	            System.out.print((char) b);
	            b = in.read();
	        }
	    } catch (FileNotFoundException e) {
	    	e.printStackTrace(); 
	      
	    } catch (IOException e) {
	      System.out.println(e.getMessage());
	     	
	    } finally {
	    	try {
	      	in.close();
	      } catch (IOException e) {
	      	e.printStackTrace();
	      }
	    }
		*/
	}
	
	        
	        
}
